package cn.pfz.domain;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.util.HashMap;

/**
 * @Author: 普发忠
 * @Date: 2021/10/19/14:46
 */
@Data
@TableName("banner")
public class Banner extends BaseDomain {
    public static final int TYPE_TRAVEL=1;//游记
    public static final int TYPE_STRATEGY=2;//攻略
    private Long refid;
    private String title;
    private String subtitle;
    private String coverUrl;
    private Integer state=STATE_NORMAL;
    private Integer seq;
    private Integer type; //1游记  2攻略
    
    public String getJsonString (){
        HashMap<String, Object> map = new HashMap<>();
        map.put("id",super.getId());
        map.put("refid",refid);
        map.put("title",title);
        map.put("subtitle",subtitle);
        map.put("coverUrl",coverUrl);
        map.put("state",state);
        map.put("seq",seq);
        map.put("type",type);
        return JSON.toJSONString(map);
    }
    
    public String getStateDisplay() {
        return state == STATE_NORMAL ? "正常" : "禁用";
    }
    
    public String getTypeDisplay() {
        return type == TYPE_TRAVEL ? "游记" : "攻略";
    }
    
}
